<html>
  <head>
    <title>Ordinal Split Banded</title>
    <script type="text/javascript" src="../../protovis.js"></script>
  </head>
  <body>
    <script type="text/javascript+protovis">

var categories = "ABCDEFGHIJK".split(""),
    data = categories.map(function(c) ({x:c, y:Math.random()})),
    w = 480,
    h = 400,
    x = pv.Scale.ordinal(categories).splitBanded(0, w, 2 / 3),
    y = pv.Scale.linear(0, 1).range(0, h),
    c = pv.Colors.category19(categories);

var vis = new pv.Panel()
    .width(w)
    .height(h)
    .margin(19.5)
    .strokeStyle("#ccc");

vis.add(pv.Bar)
    .data(data)
    .left(function(d) x(d.x))
    .width(x.range().band)
    .bottom(0)
    .height(function(d) y(d.y))
    .fillStyle(function(d) c(d.x))
  .anchor("bottom").add(pv.Label)
    .textBaseline("top")
    .text(function(d) d.x);

vis.add(pv.Rule)
    .data(y.ticks())
    .bottom(y)
    .strokeStyle("rgba(255, 255, 255, .5)")
  .anchor("right").add(pv.Label)
    .text(y.tickFormat);

vis.render();

    </script>
  </body>
</html>
